Skip to main content

All Questions

0votes
0answers
58views

Wait for results/failure of an unreliable async operation

Abstract Problem The basic problem is that of producer/consumer. Wait for an async Producer to [produce an item] or [fail], together with a timeout on the consumer side. Using Java's ...
JayC667's user avatar
2votes
1answer
353views

Producer/Consumer Multi-Thread implementation - Is the solution correct?

I recently faced this following question in a Java coding round, needless to say I did not get a callback. So I want to know where I am going wrong in my solution and also what can be done to improve ...
ng.newbie's user avatar
4votes
0answers
386views

Java multithreading many readers one writer implementations

I have a shared data object with writer threads and reader threads. Number of threads can read from the shared data at the same time (in the code getmethod), and ...
user avatar
2votes
0answers
1kviews

Many-readers-one-writer with semaphores and multithreading

I've been looking for a solution to the may readers one writer in Java. I was intrigued by this question posted here and I read the Wikipedia entry about it. So far, I've reached a fine solution, or ...
Oscar Besga Panel's user avatar
2votes
1answer
542views

Producer consumer design and implementation using Java 8

Please review my design and code implementation and suggest if any optimisation is possible in terms of performance (time complexity / space complexity ) or any better way of design or implementation. ...
Hackmaster's user avatar
5votes
1answer
2kviews

Processing a file using Producer/Consumer Model

I am trying to write a multi-threading program which implements the Producer/Consumer model. Typically, I want to use one Producer which reads lines from a file and ...
U. User's user avatar
4votes
3answers
883views

Producer-Consumer with Peterson algorithm in java

Producer-consumer problem in Java with a circular buffer of N positions. There is a single thread representing the producer that will produce consecutive integer elements There is a dimensioned ...
user avatar
3votes
3answers
5kviews

Running multiple producer and single consumer in a multithread environment

I have a below class in which add method will be called by multiple threads to populate messageByChannelReference concurrent ...
user1950349's user avatar
1vote
1answer
500views

Multithreaded Producer-Consumer pattern

I have Producer Threads A, B and C producing 3 different types of events Events A, B and C respectively. The Consumer thread can ...
Sabarish's user avatar
3votes
4answers
24kviews

Reader-writers problem using semaphores in Java

I have written my own solution to the Reader-Writers problems using semaphores based on the psuedocode from Wikipedia. I would like to gauge the correctness and quality of the code. ...
tsaebeht's user avatar
6votes
1answer
2kviews

Simulation of Multiple Producer Consumer

I am trying to implement the Multiple Producer-Consumer problem. I have made the buffer as the lock to maintain consistency of the system. Does this system actually implement multithreading? How can I ...
Rahul Shah's user avatar
5votes
1answer
2kviews

Producer Consumer using custom blocking queue

After the feedback I have got from this question, I tried to to re-implement the classic Producer Consumer problem using multithreading. The requirements are: If the queue is not full, all the ...
real gadha's user avatar
1vote
1answer
1kviews

Thread pool implementation in Java

I am studying multi-threading and have tried to implement a thread pool. Please provide feedback, mostly from multi-threading point of view. I have implemented two pools, one for adding tasks in queue ...
Krishna Kumar's user avatar
11votes
1answer
18kviews

One producer multiple consumers

I want to code the following scenario: One Producer: produces n (n=100 here) objects m Consumers (m = 5 here): consumes k (k = 10 here) objects at a time in a round robin fashion; Consumer 1 first ...
animageofmine's user avatar
6votes
2answers
2kviews

Producer consumer water cooler example

I have written a water cooler example in which the consumer drinks from the water cooler until it's empty and when it gets empty the producer fills it up. The consumers wait until it's filled up and ...
Harinder's user avatar

153050per page
close